#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "canif.h"
#include "configer.h"
#include "flashexecutor.h"
#include "opendevdialog.h"
#include "udstp.h"
#include <QMainWindow>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    QString sMarkers;
    QString sDevType;
    CanIF *canIf = new CanIF();
    FlashExecutor flashExecutor;

private slots:
    void on_openButton_clicked(bool checked);

    void on_sendButton_clicked(bool checked);

    void on_comboName_currentIndexChanged(int index);

    void on_selectApp_clicked(bool checked);

private:
    Ui::MainWindow *ui;

    bool openState = false;
    openDevDialog devDialog;
    Configer m_pConfig;
    UdsTp udsTp;

    void setLabelText(sCANObj msg);
    void setTxMsgFlag(sCANObj msg);
    void setUserTitle(QString title);
    void setVersion(uint8_t *str, uint8_t strLen);
    void setlistMessage(QString msg, uint8_t type);
    void loadFile(QString &filepath);
};
#endif // MAINWINDOW_H
